export enum ImPath {
  // 登录
  login = "login",                             // 登录
  loginByToken = 'loginByToken',               // 秘钥登录
  reconnection = 'reconnection',               // 重连
  logout = 'logout',                           // 退出

  // 同步数据
  pullDepartments = "pullDepartments",         // 同步机构
  pullUsers = "pullUsers",                     // 同步用户
  pullGroups = 'pullGroups',                   // 同步群
  pullSessions = 'pullSessions',               // 同步会话
  pullMessageBySessionIds = 'pullMessageBySessionIds',               // 同步消息
  okMessages = 'okMessages',                   // 多个消息确认
  okMessage = 'okMessage',                     // 单个消息确认
  pullSensitiveWords = 'pullSensitiveWords',   // 同步敏感词

  // 发送数据
  imMessage = 'imMessage',                     // 发送消息
  imMessages = 'imMessages',                   // 发送多个消息
  readMessages = 'readMessages',               // 消息已读

  groupCreate = 'groupCreate',                 // 建群
  groupAdd = 'groupAdd',                       // 邀请人进群


}

export class RpcData {
  path: string;
  version: number;
  status: number;
  extDataMap: Map<string, string>;
  data: object;

  constructor(path: string, version: number, status: number, extDataMap: Map<string, string>, data: object) {
    this.path = path;
    this.extDataMap = extDataMap;
    this.version = version;
    this.status = status;
    this.data = data;
  }

  static build(path: string, data: object, seq: string) : RpcData {
    let extDataMap = new Map<string, string>();
    extDataMap.set("localSeq", seq);

    return new RpcData(path, 1, 0, extDataMap, data);
  }
}


export enum SexEnum {
  male = 1,
  female = 2,
}

export enum TerminalType {
  pc = 'pc',
  android = 'android',
  ios = 'ios',
  pad = 'pad',
  ipad = 'ipad',
  web = 'web',
  hm = 'hm',
}

export enum MessageType {
  Text = 'Text',       // 文本消息
  Image = 'Image',     // 图片
  Web = 'Web',        // 网站
  File = 'File',      // 附件
  Html = 'Html',      // HTML
  Video = 'Video',      // 视频
  RichText = 'RichText',    // 富文本
  Audio = 'Audio',       // 声音
  Url = 'Url',
  Chat = 'Chat',

  Group = 'Group',
  AvGroup = 'AvGroup',
}

export enum MessageRefType {
  ref = 1,
  transfer = 2,
}

export enum MessageStatus {
  none = 0,              // 初始状态
  receive = 1,
  readed = 2,           // 被取消
  withdrawed= 3,        // 失败
  delete = 4,           // 消息在接受中， 发送文件，图片等才有这种状态
  updated = 5,
}

export enum MessageFileStatus {
  none = 0,          // 初始状态
  uploaded = 1,      // 被取消
  downloading = 2,   // 失败
  downloaded = 3,    // 消息在接受中， 发送文件，图片等才有这种状态
}

export enum MessageActionStatus {
  none = 0,           // 初始状态
  readed = 1,         // 被取消
  withdrawed = 2,     // 失败
  delete = 3,
  updated = 4,        // 消息在接受中， 发送文件，图片等才有这种状态
}